---
title: SAIF.Services.Printing architecture
summary: Architectural responsibilities, boundaries, and interaction patterns.
status: draft
owner: SAIF Case Management
last_reviewed: 2026-08-21
library: SAIF.Services.Printing
reference_type: embedded
---

# SAIF.Services.Printing architecture

`SAIF.Services.Printing` is a service-facade library that wraps two external document-related SOAP services — xPression Design ("xPresso") for document generation/printing/distribution, and SQL Server Reporting Services (SSRS) for report execution — and exposes a higher-level "letter"/report abstraction built on top of the xPression facade. It contains no UI and no BOF business-object types of its own.

## Responsibilities
- Wrap the xPression Design "xPresso" SOAP service (`clsGenerate`) to preview, print, publish, and distribute documents, via `clsPrint`.
- Wrap the SSRS `ReportExecutionService` SOAP service to load, parameterize, and render reports, via `clsRSPrint`, independently of the xPression facade.
- Provide a template-method "letter"/report abstraction (`Reporting.IReport` / `Reporting.ReportBase`) that concrete report subclasses use to build an xPression-flavored XML document and then render/print/distribute/save it through an internally owned `clsPrint` instance.
- Provide a bespoke XML-to-xPression-markup serializer (`Reporting.XDesignXDocument` / `Reporting.XDesignXElement`) with primary/foreign "key" propagation, specific to the shape expected by xPression Design templates.
- Support asynchronous document distribution via MSMQ (`documentMSMQPath`), including MSMQ transaction lifecycle management (`StartMQTransaction`/`EndMQTransaction`), as an alternative to synchronous SOAP distribution.

## Component boundaries
- **`clsPrint`**: Stateful wrapper around the `xpresso.clsGenerate` SOAP proxy. Owns preview/print/publish/distribute operations and the MSMQ async-distribution path. Depends on `SAIF.Services.Imaging.Import.clsImageImport` for the `ImportInfo` payload serialized into distribution requests.
- **`Reporting.ReportBase` / `Reporting.IReport`**: Template-method base for concrete report/letter types; orchestrates `Create → Render → Print/Distribute/Save` using an internally owned `clsPrint` instance. No confirmed production consumer was found in the scanned repository; the only concrete subclass is the test-only `MyReport`.**
- **`Reporting.XDesignXDocument` / `Reporting.XDesignXElement`**: XML document/element wrappers (inheriting `SAIFXDocument`/`SAIFXElement` from the SAIF framework) that render into xPression's proprietary markup format via `ToXpression()`.
- **`clsRSPrint`**: Separate, unrelated facade over SSRS `ReportExecutionService`, used for reports rendered directly from an SSRS report path rather than through xPression. Shares no code path with `clsPrint`/`Reporting.*` other than residing in the same assembly.
- **`xpresso.clsGenerate`** and **`SharepointReporting.ReportExecutionService`**: Auto-generated SOAP client proxies (Web References) for the external xPression Design and SSRS services, respectively. Not hand-written business logic.

## Interaction model
- `Legal` (the ASP.NET WebForms front end) and its page models (`clsLegalAncestor`, `clsLegalModel`, `frmPrintPreview.aspx.vb`) instantiate `clsPrint` directly and call operations such as `previewDocument`.
- `SAIF.Application.Claim.Legal` holds a project reference and namespace import to this library, but no direct call site to `clsPrint`/`clsRSPrint`/`Reporting.*` was confirmed in that library's scanned source; the dependency may be indirect or unused.**
- `clsPrint`, `clsRSPrint`, and `ReportBase` each obtain configuration and environment context (service URLs, `IsProduction`, `IsWeb`) through `EnvironmentServiceBase`, defaulting to `AppGlobal.EnvironmentService` when no instance is injected — enabling test/DI substitution.*
- Distribution requests route either synchronously (direct SOAP call to `xpresso.clsGenerate`) or asynchronously (serialized `CompositeRequestClass` sent to an MSMQ queue at `documentMSMQPath`, optionally under an explicit MSMQ transaction).
- `clsRSPrint` interacts only with the SSRS `ReportExecutionService` proxy and has no interaction with `clsPrint`/`Reporting.*` or MSMQ.

## Design constraints
- No direct database access, no BOF `IBusinessCriteria`/business-object pattern, and no ASP.NET page/UI code exist in this library itself.
- The four Environment API configuration keys consumed (`documentGeneratorServiceUrl`, `documentMSMQPath`, `idmFilePath`, `sqlReportingServiceUrl`) have no static fallback in this repository's `Web.config`/`app.config`; their runtime values are unknown and presumed resolved by a centralized SAIF environment-configuration service outside this library's scope.**
- Two `ApplicationSettingsBase` (`My.Settings`) design-time Web Reference URLs exist in `app.config` but are never read by consuming code — both proxies always have their `.Url` overwritten from `GetConfigSetting` at construction time, superseding the design-time defaults.*
- The `oracle.manageddataaccess.client` configuration section and `DbProviderFactories` registration exist only as a transitive artifact of referencing `Oracle.ManagedDataAccess` (via `SAIF.BOF.Framework`); no Oracle connection/command code exists in this library.*

## Architecture diagram
The following diagram shows the two independent facades (`clsPrint`/`Reporting.*` for xPression, `clsRSPrint` for SSRS) and how requests reach their respective external services synchronously or via MSMQ.

```mermaid
flowchart LR
	Legal["Legal web app<br>(clsLegalAncestor, frmPrintPreview)"] --> ClsPrint["clsPrint"]
	ReportSubclass["Concrete report/letter<br>(test-only MyReport)"] --> ReportBase["Reporting.ReportBase"]
	ReportBase --> ClsPrint
	ReportBase --> XDesign["XDesignXDocument /<br>XDesignXElement"]
	ClsPrint -->|sync| XpressoProxy["xpresso.clsGenerate<br>(SOAP proxy)"]
	ClsPrint -->|async distribute| MSMQ["MSMQ queue<br>documentMSMQPath"]
	XpressoProxy --> XpressionServer["External xPression<br>Design server"]
	ClsRSPrint["clsRSPrint"] --> RSProxy["SharepointReporting.<br>ReportExecutionService (SOAP proxy)"]
	RSProxy --> SSRSServer["External SSRS<br>report server"]
	ClsPrint -.uses.-> ImageImport["SAIF.Services.Imaging.Import<br>clsImageImport"]
```

## Sequence diagram
The following diagram shows the primary preview/print request flow through `clsPrint` to the external xPression service.

```mermaid
sequenceDiagram
	participant Client as Legal web app
	participant ClsPrint as clsPrint
	participant XpressoProxy as xpresso.clsGenerate (SOAP proxy)
	participant XpressionServer as External xPression server
	Client->>ClsPrint: previewDocument(package, xml)
	ClsPrint->>XpressoProxy: previewDocument(Package, XML, OutputProfile, Application)
	XpressoProxy->>XpressionServer: SOAP call
	XpressionServer-->>XpressoProxy: rendered document bytes
	XpressoProxy-->>ClsPrint: Byte() result
	ClsPrint-->>Client: PDF bytes
```

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [API reference](api/index.md)

## Sources
- `SAIF.Services.Printing\clsPrint.vb`
- `SAIF.Services.Printing\clsRSPrint.vb`
- `SAIF.Services.Printing\Reporting\ReportBase.vb`
- `SAIF.Services.Printing\Reporting\XDesignXDocument.vb`
- `SAIF.Services.Printing\Reporting\XDesignXElement.vb`
- `SAIF.Services.Printing\Web References\xpresso\Reference.vb`
- `SAIF.Services.Printing\Web References\SharepointReporting\Reference.vb`
- `SAIF.Services.Printing\SAIF.Services.Printing.vbproj`
